const path=require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const htmlWebpackPlugin = require('html-webpack-plugin');

module.exports={
    mode:'development',
    entry:path.join(__dirname,'./src/main.js'),
    output: {
        path: path.join(__dirname,'./dist/'),
        filename: "bundle.js"
    },
    plugins: [
        new VueLoaderPlugin(),
        new htmlWebpackPlugin({template:path.join(__dirname,'./src/index.html'),filename:'index.html'}),
    ],
    module: {
        rules: [
            {test:/\.vue$/,use:'vue-loader'},
            {
                test: /\.css/,
                use: ['style-loader','css-loader']
            },
            {
                test: /\.(png|jpg|gif|svg|woff|woff2|ttf|eot)$/,
                use:[{
                    loader: 'url-loader',
                    options: {
                        name: '[name].[ext]?[hash]',
                        esModule:false
                    }
                }] ,
            },
            {
                test:/\.scss/,
                use: ['style-loader','css-loader','sass-loader']
            }
        ]
    },
    resolve: {
        extensions: ['.js', '.vue', '.json'],
        alias: {
            '@':path.resolve('src')
        }
    }
};
